<?php
class member extends MY_Controller{
	
	public $title;
	
	function member(){
		parent::__construct();
		$this->validateCookie();
	}
	
	function index(){
		$this->project();
	}
	
	function info(){
		$id  = $this->uri->segment(3,0);
		$this->title = "Info - ".$id;
		
//		$this->title = "Member";
		
		$this->config->load("raw");
		
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("header",$header,true);
		/*
		 * send result content network
		 */
		$this->load->model("memberMod");
		$query['query'] = $this->memberMod->get_record();
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['lpanel'] = $this->load->view('theme/default/dashboard/member/lpanel','',true);
		$content['main'] = $this->load->view('theme/default/dashboard/member/info/main',$query,true);
//		$content['rpanel'] = $this->load->view('theme/default/dashboard/member/rpanel','',true);
		$con = $this->load->view("content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeView(array(
			'title'=>$page['title'],
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
//			'lpanel'=>$lpanel,
    		'content'=>$con,
//			'rpanel'=>$rpanel,
			'footer'=>$footer,
			'layout_width'=>950,
// 			'nav'=>$nav
		));
	}

	function project(){
		$id  = $this->uri->segment(3,0);
		$this->title = $id;
		
//		$this->title = "Member";
		
		$this->config->load("raw");
		
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("header",$header,true);
		/*
		 * send result content network
		 */
		$this->load->model("memberMod");
		$query['query'] = $this->memberMod->get_record();
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['lpanel'] = $this->load->view('theme/default/dashboard/member/lpanel','',true);
		$content['main'] = $this->load->view('theme/default/dashboard/member/main',$query,true);
//		$content['rpanel'] = $this->load->view('theme/default/dashboard/member/rpanel','',true);
		$con = $this->load->view("content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeView(array(
			'title'=>$page['title'],
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
//			'lpanel'=>$lpanel,
    		'content'=>$con,
//			'rpanel'=>$rpanel,
			'footer'=>$footer,
			'layout_width'=>950,
// 			'nav'=>$nav
		));
	}
	
	/*
	 * ----------------------------------------------------------------------------------------------------- show
	 */
	function showAlbum(){
		$this->load->model("albumMod");
    	$query = $this->albumMod->get_records(0);
    	    	
//		$this->load->view('theme/default/dashboard/project/showAlbum',array('query'=>$query),true);
		$this->load->view('theme/default/dashboard/member/album/showAlbum');
	}
	
	function showImages(){
		$id_album = $this->uri->segment(3,0);
//		echo $id_album;
		$this->load->model("imagesMod");
    	$query = $this->imagesMod->get_album($id_album,0);
//    	echo $query;
//		$this->load->view('theme/default/dashboard/project/showAlbum',array('query'=>$query),true);
		$this->load->view('theme/default/dashboard/member/images/showImages');
//		$this->load->view('theme/default/dashboard/project/showImages');
	}
	
	/*
	 * ----------------------------------------------------------------------------------------------------- open
	 */
	function openAlbum(){
		$id_album = $this->uri->segment(3,0);
		$this->title = $id_album;
		
		$this->config->load("raw");
		
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("header",$header,true);
		/*
		 * add query
		 */
		$id_album = $this->uri->segment(3,0);
		$this->load->model('imagesMod');
		$query = $this->imagesMod->get_album($id_album,0);
		
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['lpanel'] = $this->load->view('theme/default/dashboard/member/lpanel','',true);
		$content['main'] = $this->load->view('theme/default/dashboard/member/album/openAlbum',array('query'=>$query),true);
//		$content['rpanel'] = $this->load->view('theme/default/dashboard/project/rpanel','',true);
		$con = $this->load->view("content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeView(array(
			'title'=>$page['title'],
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
//			'lpanel'=>$lpanel,
    		'content'=>$con,
//			'rpanel'=>$rpanel,
			'footer'=>$footer,
			'layout_width'=>950,
// 			'nav'=>$nav
		));
	}
	
	function openImages(){
		$id_album = $this->uri->segment(4,0);
		$this->title = $id_album;
		
		$this->config->load("raw");
		
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("header",$header,true);
		/*
		 * add query
		 */
		$id_album = $this->uri->segment(3,0);
		$this->load->model('imagesMod');
		$query = $this->imagesMod->get_album($id_album,0);
		
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['lpanel'] = $this->load->view('theme/default/dashboard/member/lpanel','',true);
		$content['main'] = $this->load->view('theme/default/dashboard/member/images/openImages','',true);
//		$content['rpanel'] = $this->load->view('theme/default/dashboard/project/rpanel','',true);
		$con = $this->load->view("content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeView(array(
			'title'=>$page['title'],
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
//			'lpanel'=>$lpanel,
    		'content'=>$con,
//			'rpanel'=>$rpanel,
			'footer'=>$footer,
			'layout_width'=>950,
// 			'nav'=>$nav
		));
	}	
	
}